<template>
    <ads-media :ads="ads"></ads-media>
</template>

<script>

import AdsMedia from './AdsMedia.vue'
import store from './../../store'

export default {
    name: 'AdsBlock',
    components:{
        AdsMedia
    },
    props: {
        aid: Number,
        jid: Number
    },
    data (){
       return {
           ads: {}
       }
    },
    created () {
        this.update()
    },
    watch: {
        'jid': function(val){
            this.update();
        }
    },
    methods: {
        update () {
            return store.getAds(this.aid).then(ads => {
                this.ads = ads;
            })
        }
    }
}
</script>